Skip to content

f@tmah - Task2 done#17

Open
faimah57 wants to merge 1 commit intoProgramming-Club-IAU:masterfrom
faimah57:f@tmah
Open

f@tmah - Task2 done#17
faimah57 wants to merge 1 commit intoProgramming-Club-IAU:masterfrom
faimah57:f@tmah

Conversation

@faimah57
Copy link

Level 1.2 Find the Maximum of 2 Numbers in Java
this code is for find the maximum of two decimal numbers, and the number are from the user. The code Uses Scanner and if condition for checking our of these three states :
1- the first number is the maximum.
2- the second number is the maximum.
3- the first and second number are same.

Code Screen Shoot
taskss2

Code Text
import java.util.Scanner;
public class App {
public static void main(String[] args) throws Exception {
Scanner input=new Scanner(System.in);
System.out.print("Hello User, this Program Will Take Two Numbers to Print the Maximum\nPlease Enter the First Number: ");
double x=input.nextDouble();
System.out.print("Now Enter the Second Number: ");
double y=input.nextDouble();
if(x>y){
System.out.println("The First Number "+x+" Is the Maximum");
} else if (x<y){
System.out.println("The Second Number "+y+" Is the Maximum");
} else {
System.out.println("Both Number are Equal to Each Other, Please Try Again");
}
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant